package org.cn.springcloudvv.cxf.service.impl;

import org.cn.springcloudvv.cxf.annation.AutoPublishWS;
import org.cn.springcloudvv.cxf.service.WebServiceUser;
import org.cn.springcloudvv.cxf.vo.User;
import org.springframework.stereotype.Service;

import javax.jws.WebMethod;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.ws.rs.POST;

@AutoPublishWS(publishPath = "webserviceUser")
@Service
@WebService
public class WebServiceUserImpl implements WebServiceUser {

    @POST
    @WebMethod
    @WebResult(name = "user")
    @Override
    public User getUser(User user) {
        User user1 = new User();
        user1.setUserId(user.getUserId());
        user1.setUserName(user.getUserName()+"_fromserver"+System.currentTimeMillis());
        user1.setAge(user.getAge());
        user1.setPhone(user.getPhone());
        return user1;
    }

    @POST
    @WebMethod
    @WebResult(name = "user")
    @Override
    public User addUser(User user) {
        User user1 = new User();
        user1.setUserId(user.getUserId());
        user1.setUserName(user.getUserName()+"_fromserver"+System.currentTimeMillis());
        user1.setAge(user.getAge());
        user1.setPhone(user.getPhone());
        return user1;
    }

}
